package com.zhu.salesmanagement.views;

import com.dms2.salesmanagement.R;
import com.zhu.salesmanagement.models.PusherStoreItem;
import com.zhu.salesmanagement.utils.Util;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * 导购界面
 */
public class GuideInfoView extends RelativeLayout{

    private TextView mNameView = null;
    private TextView mTypeView = null;
    private TextView mMobileView = null;
    private TextView mRuzhiView = null;
    private PusherStoreItem mPusherStoreItem = null;

    public GuideInfoView(Context context) {
        this(context, null);
        // TODO Auto-generated constructor stub
    }

    public GuideInfoView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        // TODO Auto-generated constructor stub
    }

    public GuideInfoView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }

    /**
     * (non-Javadoc)
     * @see android.view.View#onFinishInflate()
     */
    public void onFinishInflate(){
        super.onFinishInflate();
        mNameView = (TextView) findViewById(R.id.storeguide_name);
        mTypeView = (TextView) findViewById(R.id.storeguide_type);
        mMobileView = (TextView) findViewById(R.id.storeguide_mobile);
        mRuzhiView = (TextView) findViewById(R.id.storeguide_ruzhi);
    }

    /**
     * 初始化数据
     */
    public void initData(PusherStoreItem pusherStoreItem){
        if(mPusherStoreItem == null){
            mPusherStoreItem = pusherStoreItem;
            mNameView.setText(pusherStoreItem.sEmployeeName);
            mTypeView.setText(pusherStoreItem.sEmployeeCategory);
            mMobileView.setText(pusherStoreItem.sMobile);
            mRuzhiView.setText(Util.getFormatTime(pusherStoreItem.dRegisterDate) +"," +pusherStoreItem.sAccreditCategoryDescription);
        }
    }
}
